home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Applications / chipmunk-basic-304 / README.basic < prev    next >
Encoding:
Text File  |  1994-10-01  |  6.9 KB  |  179 lines  |  [TEXT/ttxt]

  1. *chipmunk-basic-3.0.4-fat.hqx README*
  2.  
  3. Every personal computer should have a Basic interpreter; here's one
  4. for the PowerMac.
  5.  
  6. Chipmunk Basic is a simple Basic interpreter for the Macintosh and is
  7. accelerated for PowerMacs.  It is similar to the line number based
  8. MumbleSoft BASIC interpreters of circa 1980.  Its roots are from a
  9. pascal program, basic.p, that was part of the test input suite to p2c,
  10. a pascal to c translator.  Both basic.p and p2c should be in the
  11. net.sources archives somewhere (don't ask, I don't have a copy).  I
  12. cleaned up the translated source, ported it to the Macintosh, fixed
  13. various bugs and added several Mac specific features.
  14.  
  15. Chipmunk Basic 3.0.4 is free for non-commercial or educational
  16. distribution and use. (but only for those who don't believe that using
  17. the BASIC language causes brain damage. :-)  Please be aware that there
  18. are far better versions of BASIC available commercially. Just none that
  19. ran PowerPC native and were available for the Mac as of March 14th.
  20. It's not very fast as BASIC systems go. It does run 100 to 150
  21. times faster on a PowerMac 7100/66 than Microsoft BASIC 1.0 did on my
  22. original Mac 128.
  23.  
  24. Have fun.  And please send me any bugs reports: via email to:
  25. rhn@netcom.com  or via postal mail to:  Ronald Nicholson,
  26. 1909 Magdalena Circle #76,  Santa Clara, CA 95051  USA.
  27.  
  28.  * Chipmunk-Basic is (c) Copyright 1990,1994 Ronald H. Nicholson, Jr.
  29.  * ALL RIGHTS RESERVED
  30.  *
  31.  * Permission to use, copy and distribute this software without fee
  32.  * for non-commercial or educational purposes is hereby granted, provided
  33.  * that the above copyright notice appear in all copies and that both
  34.  * the copyright notice and this permission notice appear in supporting
  35.  * documentation.
  36.  *
  37.  * This program is distributed in the hope that it will be useful, but
  38.  * WITHOUT ANY WARRANTY OF ANY KIND; not even the implied warranty of
  39.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  40.  
  41. PowerMac Version History (summary):
  42.  
  43. 3.0.4 Sep08 DoScript scriptable; added cicn sprites & picts, scrolling.
  44. 3.0.1 bug fixes in field$; added clear, pi, cont; wrote man page.
  45. 2.9b9 bug fixes for array assignment, copy pict, ppc libs.
  46. 2.9b5 fat binary. fixed cmd-copy of graphics window.
  47. 2.9b2 94March16 virtual memory crash bug fixed.
  48. 2.9b0 94March14 first native PowerPC port.
  49.  
  50. [ chipbasic_tc ( available on ftp.netcom.com : pub/rhn ) is an older,
  51. smaller, slower version (compiled with Think C 6.0.1) that should run
  52. under System 6.0.x on 68000 Macs ( 512Ke, Plus, Classic) ]
  53.  
  54. ---
  55. Quick Reference for Chipmunk Basic v3.0.4 - PPC Macintosh version 94Sep08
  56. ported by Ronald H. Nicholson, Jr.    rhn@netcom.com
  57.  
  58. - The interpreter includes an old fashioned line number based editor.
  59. - The usual amount of numeric and string operators and functions and
  60.     file I/O statements are available.
  61. - The two variable types are long floats and strings with a maximum length
  62.     of 254 characters.  Variable names can be up to 31 characters long and
  63.     are case insensitive.
  64. - Unusual features include:
  65.     The ability to play accurate morse code through the Sound Manager.
  66.     Some simple graphics commands in a separate graphics window.
  67.  
  68. Operators, functions and statements include:
  69.  
  70.     + - * / ^ mod  and or xor not  > < >= <= <> =
  71.     sqr() log() exp() sin() cos() tan() atn()  pi
  72.     abs() sgn() int() rnd() peek() val() asc() len()
  73.     mid$() right$() left$() str$() chr$()
  74.     let goto gosub return for to step next while wend dim
  75.     rem data read restore
  76.     input print open for output append as close# load save
  77.     inkey$  input$ fgetbyte# eof()  fseek#
  78.     run stop end exit quit cont  renum  new clear  def fn
  79.     date$ time$ timer  push() pop  sound morse say  sub
  80.     cls gotoxy moveto lineto  graphics window scrn mouse()
  81.     home get htab vtab pos()  varptr peek() poke fre
  82.     
  83. Some Examples:
  84.  
  85.   for i=1 to 10 : print i : next i
  86.  
  87.   c$ = a$ + b$            : rem string concatenation
  88.   a$ = inkey$            : rem inkey$ is non-blocking 
  89.   
  90.   load "sieve.bas"        : rem load TEXT file as a Basic program
  91.   
  92.   open "filename" for output as #1 : print #1, "hello" : close #1 
  93.   
  94.   gotoxy 0,10 : print "here"        : rem text window (0,0 origin)
  95.   x = pos(0)                : rem text cursor horizontal location
  96.   y = pos(-1)                : rem vertical text cursor location
  97.   
  98.   graphics 0  : moveto 10,10 : lineto 110,80    : rem draw graphics line
  99.   
  100.   sound 440,0.5,30            : rem freq, seconds_duration, vol 0-100
  101.   sound 0,128                : rem play snd resource 128
  102.   morse "CQ DE N6YWU",16,40,13,700    : rem dot_wpm,vol,letter_wpm,freq
  103.   
  104. ---
  105. Some experimental graphics commands:
  106. *The graphics commands in version 3.0 are beta test and may be buggy.*
  107.     
  108.     GRAPHICS 0                // init graphics window
  109.     graphics WINDOW x, y, width, height    // graphics window setup
  110.  
  111.     graphics MOVETO  x,y            // Move pen To x,y
  112.     graphics LINETO  x,y            // draw Line To x,y
  113.     graphics OVAL  x,y            // oval  x wide by y high
  114.     graphics DRAWTEXT  a$            // DrawText
  115.     
  116.     graphics RECT  x1,y1,x2,y2        // FrameRect
  117.     graphics FILLRECT  x1,y1,x2,y2,pat#    // PaintRect
  118.     graphics OVAL  x1,y1,x2,y2        // FrameOval
  119.     graphics FILLOVAL  x1,y1,x2,y2,pat#    // PaintOval
  120.     graphics PENSETUP  xsize, ysize, [ mode, pat# ]
  121.     graphics COLOR  i            // set RGBForeColor by index
  122.     graphics COLOR  r,g,b            // red green blue 0-100
  123.  
  124.     graphics PICT  x,y,n            // draw 'pict' resource n
  125.     graphics TEXTSETUP f, s, m    // font, size, mode
  126.  
  127.     graphics (-34)            // get graphics window pixel depth
  128.     graphics (-38)            // get graphics window max width
  129.     graphics (-39)            // get graphics window max height
  130.     // "Preferred Size" from Finder Get Info may limit graphics window size
  131.  
  132.     // ICN#, cicn & PICT resources may be stored in the ".bas" program file
  133.  
  134.     SPRITE    n  x, y, id        // sprite n @ x,y using ICN# or cicn id
  135.                     // n from 1 to 15, 1 in frontmost plane
  136.                     // ICN# 128 - 141 included with chipbasic
  137.     sprite    n  UP    x        // sprite #n move up x pixels
  138.     sprite  n  DOWN  x
  139.     sprite  n  LEFT  x        // move LEFT (not turn as in Logo!)
  140.     sprite  n  RIGHT   x
  141.     sprite    n  TURN    d        // turn CCW d degrees
  142.     sprite    n  FORWARD x        // move forward x pixels
  143.     sprite    n  PENUP
  144.     sprite    n  PENDOWN
  145.     
  146. ---
  147. other fancy and experimental features:
  148.  
  149.     open "SFGetFile" for input as #2    // "SFPutFile" works for output
  150.     open "COM1:" for input as #3        //  *requires* CTB Serial Tool
  151.     open f$ for data input as #4    // data file, no crlf text translation
  152.     say "hello world"            //  *requires* the Speech Manager
  153.     say "faster", 196, 44, 1        //  string, rate, pitch, voice
  154.     a$ = field$("aa bb cc dd", 2, " ")    // "bb", similar to awk fields
  155.     push(x,y,a$) : gosub 200 : pop 3    // save and restore variables
  156.     sound -1,a(0),11100        // play 1 sec. samples from array a
  157.     
  158. AppleScript scriptable. Try this script from a script editor:
  159.       tell application "chipbasic" to DoScript "print 3+4"
  160.  
  161. ---
  162. 1 rem "sieve.bas" , a prime number sieve benchmark
  163. 2 t = timer
  164. 3 dim f(8194)
  165. 4 for i = 0 to 8191 : f(i) = 1 : next i
  166. 5 s = 8191
  167. 6 for i = 0 to s
  168. 7   if f(i) = 0 then goto 11
  169. 8   p = i+i+3
  170. 9   for k = i+p to s step p : f(k) = 0 : next k
  171. 10   c = c+1
  172. 11 next i
  173. 12 print c;" primes found in ";
  174. 13 t = timer-t
  175. 14 print t;" seconds"
  176. 15 end
  177.  
  178. --- cut here ---
  179.